﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;

namespace MvcProject.Models
{
    public class ProjectInfoModel
    {
        private LongShareDataContext db = new LongShareDataContext();
        
        // Query Methods
        public IQueryable<ProjectInfo> FindAllProjectInfos()
        {
            return db.ProjectInfo;
        }
        public ProjectInfo GetProjectInfo(int projectId)
        {
            return db.ProjectInfo.SingleOrDefault(d => d.ProjectId == projectId);
        }
        //
        // Insert/Delete Methods
        public void Add(ProjectInfo dinner)
        {
            db.ProjectInfo.InsertOnSubmit(dinner);
        }
        public void Delete(ProjectInfo dinner)
        {
            db.ProjectInfo.DeleteOnSubmit(dinner);
        }
        //
        // Persistence
        public void Save()
        {
            db.SubmitChanges();
        }
    }
}